package com.erp.myAdapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.erp.bean.StatusBean;
import com.erp.R;

import java.util.List;

/**
 * Created by Administrator on 2016/11/4 0004.
 * 作者：刘洋
 */
public class ChoiceAdapter extends BaseAdapter {
    private List<StatusBean> mlistbean;
    private Context mcontext;
    private LayoutInflater minflater;
    public ChoiceAdapter(List<StatusBean> listbean, Context context){
        super();
        this.mlistbean=listbean;
        this.mcontext=context;
        this.minflater=LayoutInflater.from(context);
    }
    @Override
    public int getCount() {
        return mlistbean.size();
    }

    @Override
    public Object getItem(int i) {
        return mlistbean.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder vh;
        if(view==null){
            vh=new ViewHolder();
            view=minflater.inflate(R.layout.lv_abnormal_item,null);
            vh.tv1= (TextView) view.findViewById(R.id.tv_lv_abnormal1);
            vh.tv2= (TextView) view.findViewById(R.id.tv_lv_abnormal2);
            view.setTag(vh);
        }else{
            vh= (ViewHolder) view.getTag();
        }
        StatusBean statusBean=new StatusBean();
        statusBean=mlistbean.get(i);
        vh.tv1.setText(statusBean.name);
        vh.tv2.setText(statusBean.count);
        return view;
    }
    private class ViewHolder{
        TextView tv1,tv2;
    }

}
